Skip to content

Conversation

@davidporter-id-au
Copy link
Member

@davidporter-id-au davidporter-id-au commented Oct 31, 2025

What changed?

Second refactor of domain handler to move failover flow and Global domain update flow into separate flows and functions. It will be followed by another PR to remove the duplication with the failover endpoint

Why?

follow on from 1ec9f3b

How did you test it?

Potential risks

Release notes

Documentation Changes

@davidporter-id-au davidporter-id-au changed the title Refactoring/domain handler update ii chore: Refactoring/domain handler update ii Oct 31, 2025
@davidporter-id-au davidporter-id-au changed the title chore: Refactoring/domain handler update ii chore: Refactoring/domain handler update 2/n Oct 31, 2025

s.mockMetadataMgr.On("GetDomain", mock.Anything, mock.Anything).Return(getDomainResp, nil)
s.mockMetadataMgr.On("UpdateDomain", mock.Anything, mock.Anything).Return(nil)
s.mockArchivalMetadata.On("GetHistoryConfig").Return(archiver.NewArchivalConfig("enabled", dynamicproperties.GetStringPropertyFn("disabled"), false, dynamicproperties.GetBoolPropertyFn(false), "disabled", "some random URI"))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these calls are not being made during the failover path, so this expectation being removed is expected. We don't need to look at the archival configuration if we're doing a failover.

FailoverTimeoutInSeconds: common.Int32Ptr(1),
},
err: errInvalidGracefulFailover,
err: errInvalidFailoverNoChangeDetected,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not only a graceful error condition, it refers to any change which fails validation or changes, so updating here

Signed-off-by: David Porter <[email protected]>
}

// Check the failover cool down time
if lastUpdatedTime.Add(d.config.FailoverCoolDown(intendedDomainState.Info.Name)).After(now) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate code

var failoverType constants.FailoverType = constants.FailoverTypeGrace

// Force failover cleans graceful failover state
if updateRequest.FailoverTimeoutInSeconds == nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a updateRequest.FailoverTimeoutInSeconds != nil above, can we move this block to the else branch?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, good call

Signed-off-by: David Porter <[email protected]>
Signed-off-by: David Porter <[email protected]>
expectedErr error
}{
{
name: "local domain with valid config",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this validation function isn't being used on local domains anymore

@davidporter-id-au davidporter-id-au enabled auto-merge (squash) November 1, 2025 00:22
@davidporter-id-au davidporter-id-au merged commit 2226fa9 into cadence-workflow:master Nov 3, 2025
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants